package com.work.service.impl;

import com.work.bean.Student;
import com.work.dao.DBDao;
import com.work.dao.impl.DBImpl;
import com.work.service.MyStudentService;
import com.work.utils.Constants;
import com.work.utils.SQLUtil;

import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 2017/10/7.
 */
public class MyStudentServiceImpl implements MyStudentService {

    private DBDao dao;

    public MyStudentServiceImpl() {

        dao = new DBImpl();
    }

    @Override
    public HashMap<Integer, List> pageByTeacherId(int countPage, int whichPage, int teacherId) {
        return dao.page(countPage,whichPage, SQLUtil.findMyStudentSql(teacherId), Constants.MYSTUDENT);
    }

    @Override
    public boolean updateClassId(String id) {
        return dao.insertAndDelAndUpdate(SQLUtil.updateClassId(id));
    }

    @Override
    public List<Student> findByClassId(String id) {
        return dao.find(SQLUtil.findStudentByClassIdSql(id), Constants.STUDENT);
    }
}
